/**
 * 币种相关API
 */
import { get, post } from '@/utils/request'

/**
 * 获取币种价格信息
 * @param {string} symbol 币种符号
 * @returns {Promise}
 */
export const getSpontaneousCoinPriceApi = (symbol) => {
  return get(`/api/spontaneous/price/${symbol}`)
}

/**
 * 获取币种订单簿（买卖盘口）
 * @param {string} symbol 币种符号
 * @param {number} limit 返回数量限制，默认20
 * @returns {Promise}
 */
export const getSpontaneousCoinOrderBookApi = (symbol, limit = 20) => {
  return get(`/api/spontaneous/orderbook/${symbol}?limit=${limit}`)
}

/**
 * 批量获取币种价格信息
 * @param {Array} symbols 币种符号数组
 * @returns {Promise}
 */
export const getSpontaneousCoinPricesApi = (symbols) => {
  return post('/api/spontaneous/prices', { symbols })
}

/**
 * 获取币种24小时统计数据
 * @param {string} symbol 币种符号
 * @returns {Promise}
 */
export const getSpontaneousCoinTickerApi = (symbol) => {
  return get(`/api/spontaneous/ticker/${symbol}`)
}

/**
 * 批量获取币种24小时统计数据
 * @param {Array} symbols 币种符号数组
 * @returns {Promise}
 */
export const getSpontaneousCoinTickersApi = (symbols) => {
  return post('/api/spontaneous/tickers', { symbols })
}
